//
// Copyright (c) 2009-2011, chunquedong
//
// This file is part of ChunMap project
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE(Version >=3)
//
// History:
//   2011-10-23  Jed Young  Creation
//


using chunmapModel
using chunmapRaster
using chunmapView
using util
using wisp

**
** for example: fan chunmapService /D:/code/data/t/map2.cmp
**
class Main : AbstractMain
{
  @Arg { help = "cmp file path" }
  File? path

  @Opt { help = "http port"; aliases=["p"] }
  Int port := 8080

  override Int run()
  {
    in := path.in
    layers := in.readObj
    in.close

    return runServices(
    [
      WispService
      {
        it.port = this.port

        //cr := CoordRef{ srid = 1234; name="temp"; projection = Mercator{ name ="mercator" }}
        //Reprojection.changeMapCrs(list, cr)

        //it.root = GService(layers, ImageCache())
        //it.root = WebMapService(layers, "wms")
        it.root = TileService(layers)
      }
    ])
  }
}

